import Vue from 'vue'
import VueRouter from 'vue-router'
import Book from "../views/Book";

import BookManage from "../views/BookManage";
import AddBook from "../views/AddBook";
import PageThree from "../views/PageThree";
import PageFour from "../views/PageFour";
import Index from "../views/Index";
import UpdateBook from "../views/UpdateBook";

Vue.use(VueRouter)

const routes = [{
        path: '/book',
        name: 'Book',
        component: Book,
        // 相当于一个标记，可以用于控制是否显示
        show: true
    },
    {
        path: '/',
        name: '图书管理',
        redirect: '/bookmanage',
        component: Index,
        // 子导航
        children: [{
            path: '/bookmanage',
            name: '查询图书',
            component: BookManage,
            show: true

        },
            {
                path: '/addbook',
                name: '添加图书',
                component: AddBook,
                show: true

            },
            {
                path: '/updatebook',
                name: '修改图书',
                component: UpdateBook,
                show: false

            }
        ]
    },
    {
        path: '/',
        name: '导航2',
        component: Index,
        children: [{
            path: '/page03',
            name: 'PageThree',
            component: PageThree,
            show: true
        },
            {
                path: '/page04',
                name: 'PageFour',
                component: PageFour,
                show: true
            }

        ]
    }

]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
